package com.gopher.gauth.exception;


import com.gopher.gauth.model.ResponseData;
import org.apache.shiro.authz.AuthorizationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

@ControllerAdvice
public class GAuthExceptionAdvice {

    private static Logger log = LoggerFactory.getLogger(GAuthExceptionAdvice.class);

    @ExceptionHandler(AuthorizationException.class)
    @ResponseStatus(HttpStatus.FORBIDDEN)
    @ResponseBody
    public ResponseData handleException(AuthorizationException e, Model model) {
        return ResponseData.error("权限不足");
    }


}
